UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OLt/+C+Us8tGL00gO4Hd/7Pam2qJfLrDayMmaCvVtQ8=' 
WHERE 
  key_id = 'e24ac958f05fc97eca403219226031ca41e1809bfc4836d4977d486938e1a361' 
  AND (
    token = 'OLt/+C+Us8tGL00gO4Hd/7Pam2qJfLrDayMmaCvVtQ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042