UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tYZf56U3svZoIJni74DcYNfb3v/JwbzENU/sXzVWYj4=' 
WHERE 
  key_id = '69fea55c2188ee1712f601f331db66921673d0daa75c7177de6f579e08af95df' 
  AND (
    token = 'tYZf56U3svZoIJni74DcYNfb3v/JwbzENU/sXzVWYj4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065