UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IvkHIWLnbK+6EcNdimV79alRmy2jNHf2kTP47ZM1kOc='
WHERE
key_id = '0718d5ff6ac98364d8e6efea569e3b27ce5efa1f1294af31bccee1e58f7ef1ea'
AND (
token = 'IvkHIWLnbK+6EcNdimV79alRmy2jNHf2kTP47ZM1kOc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)