UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9WTyeKNoEFi5o4kXjrSG0V6HQOnAQe4iScEcjCNhwIY=' 
WHERE 
  key_id = '2ce2b66812e4e25aec5d65099f1f7912544de66f310d283c26377ba4161a750a' 
  AND (
    token = '9WTyeKNoEFi5o4kXjrSG0V6HQOnAQe4iScEcjCNhwIY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038