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