UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SPJq++RKy2tL9hhb3px+JJNuByXpkk11mfpa5y2rWfU=' 
WHERE 
  key_id = '68fdc66b790633c612b7044524322d164512e8d14f35eb418b2e51bdb43b66c0' 
  AND (
    token = 'SPJq++RKy2tL9hhb3px+JJNuByXpkk11mfpa5y2rWfU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028