UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rR7kHPvsqiRjrzq6L6fWvm7+JZt00+mH6RB3feIHLHs='
WHERE
key_id = 'a3ab754ba1b6032a88ceb6c2c3cff9eee6b51b85e6f2cffa5b234dde96ee87f0'
AND (
token = 'rR7kHPvsqiRjrzq6L6fWvm7+JZt00+mH6RB3feIHLHs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)