UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RqaijgoM6IRHyEr2nJgZB1Som9vCCkmNCiC1uwLhAX8='
WHERE
key_id = '058121ec15428e5929a56e22ab2c4fc87394832b8948152230cd619d8b0b3090'
AND (
token = 'RqaijgoM6IRHyEr2nJgZB1Som9vCCkmNCiC1uwLhAX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)