UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sMQUhZdqAkcitHj9yX6SUWITRxu3MWItAcXL0LjQ/M0='
WHERE
key_id = 'aff83045bcdbe484ab787be1fbf2841bb8171ad294d9af8d1131ff1bbf16f04b'
AND (
token = 'sMQUhZdqAkcitHj9yX6SUWITRxu3MWItAcXL0LjQ/M0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)