UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NFvEReMlFJjVZMqMOQosXopuDmrIFZK7/MhOka9GrY8='
WHERE
key_id = '317e5e9e7dd8b92b113ec54aa818292a37213389bde3741e1e2182aec74c7201'
AND (
token = 'NFvEReMlFJjVZMqMOQosXopuDmrIFZK7/MhOka9GrY8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)