UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jV1no2CcrW4+FdH0CiZNhoUvVm9duqbjXB0Y7/sObdY='
WHERE
key_id = 'e35fbf5cdb67988a23e183295e5ad385da8d5e76b0dd1e73978858385390777f'
AND (
token = 'jV1no2CcrW4+FdH0CiZNhoUvVm9duqbjXB0Y7/sObdY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)