UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'klQQiaBnF9fdNIa/tGuF2TyffXUJfxzXgq4hzaazsGg=' 
WHERE 
  key_id = '91b4ae634a2fa4dfcf62dcbcedbfda99e4b936b95435b143df4efb3722151cad' 
  AND (
    token = 'klQQiaBnF9fdNIa/tGuF2TyffXUJfxzXgq4hzaazsGg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030