UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rJL5ydkUWUBsrFs1YdkJZBX0Dm0wV8LhyvYpEffct78=' 
WHERE 
  key_id = '674dcafbc7bf89c3f447cc70c6e2bb44f97fa582fdf91082828fd9b321141b18' 
  AND (
    token = 'rJL5ydkUWUBsrFs1YdkJZBX0Dm0wV8LhyvYpEffct78=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032