UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6+KvcZXso8GQzwb9uqi6KJ4e0sb1iH+cSAqV66Z3HLE='
WHERE
key_id = 'f7845c072a2f4ef01a2b27cba4829fea4ce40cbf1725ba9a68e4224a44923d8e'
AND (
token = '6+KvcZXso8GQzwb9uqi6KJ4e0sb1iH+cSAqV66Z3HLE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)