UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't8vU6mhk7VEXNVIFVElgcqfa6WCnLBpSZrgWLlvHx1g='
WHERE
key_id = 'e7f5b308cb8f3cdb7caead830df1a0a2201b6b2a9ba30560adf40e9b3ae77bfc'
AND (
token = 't8vU6mhk7VEXNVIFVElgcqfa6WCnLBpSZrgWLlvHx1g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)