UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'quKrYaqRw//Uvoz31TbZ7Bw0UsH6p0WwrrY8BPcdDTU=' 
WHERE 
  key_id = 'f54b354bab384eecd43e58900625f26a276fc49050aa5989f36f79a9beab68e3' 
  AND (
    token = 'quKrYaqRw//Uvoz31TbZ7Bw0UsH6p0WwrrY8BPcdDTU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016