UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZCCScc90BNO8JyUo57pfHRoiArM5gQckFjK4Cas2ygo=' 
WHERE 
  key_id = '2ad1343e2b9c7f1417488e323c97b0606768eac33e48c5a0fcb54aca276fa523' 
  AND (
    token = 'ZCCScc90BNO8JyUo57pfHRoiArM5gQckFjK4Cas2ygo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030