UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BKPO+0QjyWfj2XeZ6LpfPUWYRMgiywXF6u/KtlQV8wQ=' 
WHERE 
  key_id = '74faf88645ea0f0593f1f9c530e2d22b2b6c6e54980b30f26cd83f8293e77aa3' 
  AND (
    token = 'BKPO+0QjyWfj2XeZ6LpfPUWYRMgiywXF6u/KtlQV8wQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028