UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aRpOA1brrUkKnDqP1RQ13iu6hhixJu7LyjqgzN+BcYA='
WHERE
key_id = 'b7290620d12290e2a077e15a854b2998dac1742c6412a20011ef2a48e535c1d5'
AND (
token = 'aRpOA1brrUkKnDqP1RQ13iu6hhixJu7LyjqgzN+BcYA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)