UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zgp+pewOv85tTJsjZNz7CxKiEVZ0IPuQOwNP1OADsp0=' 
WHERE 
  key_id = '51806cb3303fa1f761a9553917eee0682fd70d21903fb7dd7e89deb4787ae9df' 
  AND (
    token = 'Zgp+pewOv85tTJsjZNz7CxKiEVZ0IPuQOwNP1OADsp0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026