UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y51ghn2y3AykByjHd4bKXm2u8OZp9BzpQsK6gNX76ho='
WHERE
key_id = '86ad5e6b6b8832285fce2769cb9185f8983b449af0d0f140f8d0cef5c609afc4'
AND (
token = 'y51ghn2y3AykByjHd4bKXm2u8OZp9BzpQsK6gNX76ho='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)