UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QmiA4venVRsxJdq2SU6eNJPxHXkdEZ+WQ9VD/FA9R04='
WHERE
key_id = '1fe9e5623637810d021686f199c6efba99c3ef63ecc332e37d5002aab221c6b2'
AND (
token = 'QmiA4venVRsxJdq2SU6eNJPxHXkdEZ+WQ9VD/FA9R04='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)