UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'l2UY79LV52xF9jOyk1cz0Nd0vxNLbFtsfRab0iy+V6M='
WHERE
key_id = 'a7fa786f95b6cedad6325f68f651513bf27b7fda368392cd79bacf4a316a8dea'
AND (
token = 'l2UY79LV52xF9jOyk1cz0Nd0vxNLbFtsfRab0iy+V6M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)