UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n6jhfNKyyRwz3pRch1phgxlVPYbjzSsN/b69WfyAzUs='
WHERE
key_id = '7c94f5ae68b9a6c9ef8a893eb34b794e99ab040a22a033f5ac0649270ef88886'
AND (
token = 'n6jhfNKyyRwz3pRch1phgxlVPYbjzSsN/b69WfyAzUs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)