UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3KTCmEdvUH2RQAXAaRJX7Y2b8vquwBQ/c12uoEaooC0='
WHERE
key_id = 'a28d072851b5db3e221ad5fb7edd5eaa29b630bf9261724f94c22018e8336802'
AND (
token = '3KTCmEdvUH2RQAXAaRJX7Y2b8vquwBQ/c12uoEaooC0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)