UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NWVZGoESr2466xT4/R+KrtoWWscPZoDefpl7J4eumhs='
WHERE
key_id = 'e7de4affbdeafd86e825de137b86d0989968586c7a1bdabd9510de1ce69ed9d6'
AND (
token = 'NWVZGoESr2466xT4/R+KrtoWWscPZoDefpl7J4eumhs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)