UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NJ9Uj3VUf8TQVLjz/RLAPLmoBEYTFouuewr+tJ7d+J8=' 
WHERE 
  key_id = 'a8c4712d6f92d56112276e9dda437c8c7862d677c3e58c74652bde159daf74d6' 
  AND (
    token = 'NJ9Uj3VUf8TQVLjz/RLAPLmoBEYTFouuewr+tJ7d+J8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037