UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6TAe/GWuPbB1LM34/iE+E38kWEWqNW5ceRwt53fAgK8='
WHERE
key_id = 'e6d2389b14e802883c31cc3e247c337e6d5ce2d6ad3470f3d1977ec58bd0f2ac'
AND (
token = '6TAe/GWuPbB1LM34/iE+E38kWEWqNW5ceRwt53fAgK8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)