UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PJtqiLjWLCslkHZsd42j7APGHFZimCYgZTYGTYOlSEk='
WHERE
key_id = 'ac7d024a8bbc231c44cddc5b426e22dc0caf7ae4edbaffd6f3a57c8b87d7c909'
AND (
token = 'PJtqiLjWLCslkHZsd42j7APGHFZimCYgZTYGTYOlSEk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)