UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aRSJ7BiBqPJi2BQJd+lXpsdp+cvq0cws9pfwVp+LT4s='
WHERE
key_id = 'd8fcf70d3a513e63de155e6f85a0a7ecd9ce35b161ca6ec50d6bd3f4edfd2885'
AND (
token = 'aRSJ7BiBqPJi2BQJd+lXpsdp+cvq0cws9pfwVp+LT4s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)