UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KMh6RQml12cJmGE4rlSaJykTGut7Vf7+3pojJI+IVlg=' 
WHERE 
  key_id = '5b76d52a11a698ca8b26e35e5f130fa4ca60bad7f014f9208538b34864a9c569' 
  AND (
    token = 'KMh6RQml12cJmGE4rlSaJykTGut7Vf7+3pojJI+IVlg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033