UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hmf0W2DI+UncjbwoW6Uz+ZQhhYp+vGpEnwGkXibEtEE=' 
WHERE 
  key_id = '12fb3665dd523a1f2445eee3dee32503b12715f5dc53a7ee8681c35eef857c21' 
  AND (
    token = 'hmf0W2DI+UncjbwoW6Uz+ZQhhYp+vGpEnwGkXibEtEE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029