UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6Hd6R2GadaBLduqWNTFKZg8G80d5Se6TlTJKN+lejco=' 
WHERE 
  key_id = '27928afbf6ae73ebb4b478525b101ce5e1744df7f05654dfa5e28dab261d06b8' 
  AND (
    token = '6Hd6R2GadaBLduqWNTFKZg8G80d5Se6TlTJKN+lejco=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037