UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ebF/fwexgfDokCAozyeIKGEXErYpujc70GfoGq73yDc=' 
WHERE 
  key_id = 'd36307054a075e462b78a4c7cee593a414e46607cf84c9d1593ea1c38c2403f1' 
  AND (
    token = 'ebF/fwexgfDokCAozyeIKGEXErYpujc70GfoGq73yDc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029