UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hUA6paqDSOdGwCDHbRN3w5LsLvdP1abpq7jkuJ9n5ZI='
WHERE
key_id = '9d0b6e9d195f955b6e02f9c04bde9e0c1ca76a8b6b84efe0c87f1b3a3a70ea0c'
AND (
token = 'hUA6paqDSOdGwCDHbRN3w5LsLvdP1abpq7jkuJ9n5ZI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)